package com.example.back.controller;

import com.example.back.entity.Relations;
import com.example.back.service.RelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

@RestController
public class RelationController {
    @Autowired
    private  RelationService relationService;
    @PostMapping("/relation")
    public int addRelation(@RequestBody Relations relations){
        return relationService.addRelation(relations);
    }

    @GetMapping("/relation")
    public ArrayList<Relations> queryUserRelation(Relations relations){

        return relationService.queryUserRelation(relations);
    }
    @DeleteMapping("/relation/{id}")
    public int deleteRelationById(@PathVariable("id") Integer id) {
        return relationService.deleteRelation( id);
    }

}
